<?php
/**
 * Created by PhpStorm.
 * User: ship
 * Date: 2024/12/26
 * Time: 14:35
 */

namespace ShipSun\LaravelSignature;

/**
 * Class HmacShaParse
 * @package ShipSun\LaravelSignature
 * @deprecated
 */
class HmacShaParse
{
    public function parse(string $str)
    {
        return $this->toArray($str);
    }

    protected function toArray($str)
    {
        $data = explode(',', $str);
        $newData = [];
        foreach ($data as $val) {
            $kv = explode('=', $val);
            if (count($kv) != 2) {
                continue;
            }
            $newData[trim($kv[0])] = trim($kv[1], '"');
        }
        return $newData;
    }
}